package com.kgc.service.interf.user;

import com.kgc.entity.User;

import java.io.UnsupportedEncodingException;
import java.security.NoSuchAlgorithmException;

/**
 * @author hyj
 * @time 2024/4/1 14:36
 * @describe
 */

public interface UserService {
    /**
     * 注册
     *
     * @param user user
     * @return 1:success 0:fail
     */
    Integer register(User user) throws UnsupportedEncodingException, NoSuchAlgorithmException;

    /**
     * 登录
     *
     * @param username 用户名/邮箱
     * @param password 密码
     * @return null:not_exist User:exist
     */
    User login(String username, String password) throws NoSuchAlgorithmException;

    /**
     * 更新用户密码
     *
     * @param email    邮箱
     * @param password 密码
     * @return 1:success 0:fail
     */
    Integer updateUser(String email, String password) throws NoSuchAlgorithmException;

    /**
     * 查询该邮箱是否存在
     *
     * @param email 邮箱
     * @return null:not_exist User:exist
     */
    Integer isExist(String email);
}
